﻿Imports System.Data.OleDb
Imports System.Data
Namespace Arwani
    Partial Class Backend_Default
        Inherits System.Web.UI.Page

        Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
            If Me.txtUserName.Text = "" Then Me.lblError.Text = "Please enter username" : Exit Sub
            If Me.txtPassword.Text = "" Then Me.lblError.Text = "Please enter password" : Exit Sub
            Dim strQ As String = "select * from login where username='" & Me.txtUserName.Text.Replace("'", "") & "' and password='" & Me.txtPassword.Text.Replace("'", "") & "'"
            Dim arwCon As New ArwaniController
            Dim dtTable As DataTable = arwCon.ExecuteQuery(strQ)
            If dtTable.Rows.Count > 0 Then
                Session("ADMIN_USER") = Me.txtUserName.Text
                Response.Cookies("ADMIN_USER").Value = Me.txtUserName.Text
                Response.Redirect("DashBoard.aspx")
            Else
                Me.lblError.Text = "Invalid user name or password"
            End If
        End Sub

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub
    End Class
End Namespace